package com.example.day23;

/**
 * @author Lenovo
 */
public class PredicateDemo011 {
    public static void main(String[] args) {
        boolean b1 =checkString("hello", s->s.length()>8);
        System.out.println(b1);
        boolean b2 =checkString("hello", s->s.length()>8);
        System.out.println(b2);
    }
    public static boolean checkString(String str,MyPredicate<String> mp){
        return mp.test(str);
    }
}
public class PredicateDemo02 {
    public static void main(String[] args) {
        boolean b1 = checkString("hello", s -> s.length() > 8);
        System.out.println(b1);
        boolean b2 = checkString("helloworld", s -> s.length() > 8);
        System.out.println(b2);
        boolean b3 = checkString("hello",s -> s.length() > 8, s -> s.length() < 15);
        System.out.println(b3);
        boolean b4 = checkString("helloworld",s -> s.length() > 8, s -> s.length() < 15);
        System.out.println(b4);
    }
    private static boolean checkString(String s, Predicate<String> pre1,
                                       Predicate<String> pre2) {
        return pre1.or(pre2).test(s);
}
    private static boolean checkString(String s, Predicate<String> pre){
        return pre.test(s);
    }
}
